import { DBMgr } from "../src/module/db";

type T_USER = {
    id: number
    uname: string
    lastlogin?: Date
    open_id: string
}
DBMgr.ins.init()


async function testCreateMany(){
    //批量插入
    
    let users:T_USER[] = [] ;
    for(let i=0;i<1000;i++){
        let u = {
            id: Date.now()+i,
            uname: "",
            open_id: ""
        } 
        users.push(u)
    }
    return await DBMgr.ins.prisma.t_user.createMany({data:users})
}

async function testFindMany() {
    //批量插入
    
    return await DBMgr.ins.prisma.t_user.findMany({where:{
        "AND":{
            id:{
                gt:1000,
                lt:200000
            },
        }
    }})
}

async function clearTestData() {
    
}

async function main(){

    await testCreateMany()

    await testFindMany()
}